#include <uorb_sub.hpp>
#include <uorb_utils.hpp>

UorbSub::UorbSub(const char* uorbName)
	: m_SubId(-1)
{
	strncpy(m_UorbName, uorbName, UORB_NAME_SIZE);
	m_SubId = UorbUtils::Instance()->Subscribe(uorbName);
}

UorbSub::UorbSub(const char* uorbName, int size)
	: m_SubId(-1)
{
	strncpy(m_UorbName, uorbName, UORB_NAME_SIZE);
	m_SubId = UorbUtils::Instance()->SubscribeAuto(uorbName, size);
}

UorbSub::~UorbSub()
{
}

bool UorbSub::Copy(void* data, int size)
{
	return UorbUtils::Instance()->Copy(m_UorbName, m_SubId, (char*)data, size);
}